<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_payment.*" %>
<%@page import="com.lmpop.trade.ti_member.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ti_payment ti_payment = new Ti_payment();
	Ti_memberInfo member = new Ti_memberInfo();
	String s_pay_name = "";
	if(request.getParameter("s_pay_name")!=null && !request.getParameter("s_pay_name").equals("")){
		s_pay_name = request.getParameter("s_pay_name");
		ti_payment.setPay_name(s_pay_name);
	}
	String s_enabled = "";
	if(request.getParameter("s_enabled")!=null && !request.getParameter("s_enabled").equals("")){
		s_enabled = request.getParameter("s_enabled");
		ti_payment.setEnabled(s_enabled);
	}
	//ti_payment.setCust_id("100000000000000");
	Ti_paymentInfo ti_paymentInfo = new Ti_paymentInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_paymentInfo.getListByPage(ti_payment,Integer.parseInt(iStart),limit);
	int counter = ti_paymentInfo.getCountByObj(ti_payment);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?s_pay_name="+s_pay_name+"&s_enabled="+s_enabled+"&iStart=",Integer.parseInt(iStart),limit);
%>
<html>
  <head>
    
    <title>ti_payment Manager</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="payment.js"></script> 
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>	
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>支付方式管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				支付方式名称:<input name="s_pay_name" id="s_pay_name" type="text" />
				启用状态:<select name="s_enabled" id="s_enabled">
				<option value="">请选择</option>
				<option value="0">启用</option>
				<option value="1">禁用</option>
				</select>	
			
			<input name="searchInfo" type="button" value="查询" onclick="return search();"/></td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<!--<th>支付方式编码</th>
		  			  			  			  			  	
		  	<th>商户帐号</th>
		  	
		  	<th>商户密钥</th>		  	
		  	<th>支付手续费</th-->
		  	<th>会员名称</th>
		  	
		  	<th>支付方式名称</th>
		  	
		   
		  	
		  	
		  	
		  	<th>启用状态</th>
		  	
		  	<th>操作时间</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
			for(int i=0;i<list.size();i++){
				Hashtable map = (Hashtable)list.get(i);
			String pay_id="",pay_code="",pay_name="",pay_desc="",pay_account="",passwd="",hand_fare="",enabled="",user_id="",in_date="",enable="",cust_id="",cust_name="";
			if(map.get("pay_id")!=null) pay_id = map.get("pay_id").toString();
	  	if(map.get("pay_code")!=null) pay_code = map.get("pay_code").toString();
	  	if(map.get("pay_name")!=null) pay_name = map.get("pay_name").toString();
	  	if(map.get("pay_desc")!=null) pay_desc = map.get("pay_desc").toString();
	  	if(map.get("pay_account")!=null) pay_account = map.get("pay_account").toString();
	  	if(map.get("passwd")!=null) passwd = map.get("passwd").toString();
	  	if(map.get("hand_fare")!=null) hand_fare = map.get("hand_fare").toString();
	  	if(map.get("enabled")!=null) enabled = map.get("enabled").toString();
	  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
	  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
	  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
			if(in_date.length()>19)in_date=in_date.substring(0,19);
			if(enabled.equals("0")){enable="启用";}
	  	if(enabled.equals("1")){enable="禁用";}
		 	cust_name = member.getCustNameByPk(cust_id);
		 	if (cust_id.equals("100000000000000")) cust_name = "运营商";
		 %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=pay_id %>" /></td>
			
		  	<!--<td><%=pay_code%></td>
  	
		  	<td><%=pay_account%></td>
		  	
		  	<td><%=passwd%></td>
		  	<td><%=hand_fare%></td--> 	
		  	<td><%=cust_name%></td>
		  	
		  	<td><a href="updateInfo.jsp?pay_id=<%=pay_id %>"><%=pay_name%></a></td>
		  	<td><a href="index.jsp?s_enabled=<%=enabled%>"><%=enable%></a></td>
		  	<td><%=in_date%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?pay_id=<%=pay_id%>&s_pay_name=<%=java.net.URLEncoder.encode(s_pay_name)%>&s_enabled=<%=s_enabled%>&iStart=<%=iStart%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=pay_id%>','6768');"><img src="/program/admin/images/delete.gif" title="删除" /></a></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="8%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td width="8%">
				<input type="button" name="oper0" onclick="oper('0')" value="启用" class="buttab"/>
			</td>
			
			<td  width="72%">
				<input type="button" name="oper1" onclick="oper('1')" value="禁用" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input name="pay_id" id="pay_id" type="hidden" value=""/>
	  <input type="hidden" name="enabled" id="enabled" value="" />	  
	  <input type="hidden" name="bpm_id" id="bpm_id" value="6768" />
	  </form>
</body>

</html>
